#include <54func.h>
#include <string>
#include <iostream>
#include <vector>
#include <workflow/WFFacilities.h>
#include <workflow/MySQLUtil.h>
#include <workflow/MySQLMessage.h>
#include <workflow/MySQLResult.h>
using std::vector;
using std::string;
using std::cerr;
static WFFacilities::WaitGroup gWaitGroup(1); 
// 阻塞主线程，直到按下ctrl+c
void handler(int signum){
    printf("signum = %d\n", signum);
    gWaitGroup.done(); //计数器减一
}
void timerCallback(WFTimerTask *timerTask){
    time_t now = time(NULL);
    cerr << "second = " << ctime(&now);
    WFTimerTask * nextTimerTask = 
    WFTaskFactory::create_timer_task(2,0,timerCallback);
    series_of(timerTask)->push_back(nextTimerTask);
}
int main(){
    signal(SIGINT,handler);
    time_t now = time(NULL);
    WFTimerTask * timerTask = 
    WFTaskFactory::create_timer_task(2,0,timerCallback);
    cerr << "first = " << ctime(&now);
    timerTask->start();
    gWaitGroup.wait(); // 等待直到计数器为0
}
